<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>SI18N</title>
    <meta name="keywords" content="SI18N">
    <meta name="description" content="SI18N">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="<?= base_url('assets/css/bootstrap.min.css?v=3.3.6') ?>" rel="stylesheet">
    <link href="<?= base_url('assets/css/font-awesome.css?v=4.4.0') ?>" rel="stylesheet">

    <link href="<?= base_url('assets/css/animate.css') ?>" rel="stylesheet">
    <link href="<?= base_url('assets/css/style.css?v=4.1.0') ?>" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div style="margin: 0 auto; width: 300px; height: 200px">

                <h4 class="logo-name" style="font-size: 100px;">SI18N</h4>

            </div>
<!--            <h3>欢迎使用 </h3>-->

            <form class="m-t" role="form" id="login_form" action="index.html">
                <div class="form-group">
                    <input type="username" id="username" name="username" class="form-control" placeholder="用户名" required="" >
                </div>
                <div class="form-group">
                    <input type="password" id="password" name="password" class="form-control" placeholder="密码" required="">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b" id="btn_login">登 录</button>


<!--                <p class="text-muted text-center"> <a href="--><?//= base_url('login/password') ?><!--"><small>获取登录密码</small></a>-->
<!--                </p>-->

            </form>
        </div>
    </div>

    <?php include "include/admin_foot_script.php" ?>

</body>

<script>
    $(function () {

        var icon = "<i class='fa fa-times-circle'></i> ";

        $("#login_form").validate({
            rules: {
                email: {
                    required: true
                },
                password : {
                    required: true
                }

            },
            messages: {
                username: icon + "请输入您的用户名",
                password: icon + "请输入登录密码"
            },

            submitHandler: function (form) {
                //getPassword();
                login();
            }
        });
    });

    var  logining = false;

    function login() {

        if (logining) {
             toastr.warning("登录中.....", '提示');
              return;
        }

        var username = $("#username").val();
        var password = $("#password").val();
        if (username == '') {
            return;
        }

        $("#btn_login").html("登录中...");

        getPwd = true;

        $.post("<?= base_url('login/signIn') ?>", {"username": username, "pwd": password}, function (res) {
            $("#btn_login").html("登录");
            logining = false;
            if (res.code == 200) {
                window.location.href = res.url;
            } else {
                toastr.error(res.msg, '提示');
            }

        }, "json");
    }

</script>

</html>
